<?php

App::uses('AppModel', 'Model');

/**
 * ProductShop Model
 *
 * @property Shop $Shop
 * @property Product $Product
 */
class ProductShop extends AppModel {

  /**
   * Display field
   *
   * @var string
   */
  public $displayField = 'id';

  /**
   * Validation rules
   *
   * @var array
   */
  public $validate = array(
      'shop_id' => array(
          'numeric' => array(
              'rule' => array('numeric'),
          //'message' => 'Your custom message here',
          //'allowEmpty' => false,
          //'required' => false,
          //'last' => false, // Stop validation after this rule
          //'on' => 'create', // Limit validation to 'create' or 'update' operations
          ),
      ),
      'product_id' => array(
          'numeric' => array(
              'rule' => array('numeric'),
          //'message' => 'Your custom message here',
          //'allowEmpty' => false,
          //'required' => false,
          //'last' => false, // Stop validation after this rule
          //'on' => 'create', // Limit validation to 'create' or 'update' operations
          ),
      ),
      'quantity' => array(
          'numeric' => array(
              'rule' => array('numeric'),
         'message' => 'Solo Numeros',
          //'allowEmpty' => false,
          //'required' => false,
          //'last' => false, // Stop validation after this rule
          //'on' => 'create', // Limit validation to 'create' or 'update' operations
          ),
      ),
      'minimun_stock' => array(
          'numeric' => array(
              'rule' => array('numeric'),
              'message' => 'Solo se admiten numeros',
          //'allowEmpty' => false,
          //'required' => false,
          //'last' => false, // Stop validation after this rule
          //'on' => 'create', // Limit validation to 'create' or 'update' operations
          ),
      ),
      'current_stock' => array(
          'numeric' => array(
              'rule' => array('numeric'),
              'message' => 'Solo se admiten numeros',
          //'allowEmpty' => false,
          //'required' => false,
          //'last' => false, // Stop validation after this rule
          //'on' => 'create', // Limit validation to 'create' or 'update' operations
          ),
//                    		'notempty' => array(
//				'rule' => array('notempty'),
//				'message' => 'Your custom message here',
//				//'allowEmpty' => false,
//				//'required' => false,
//				//'last' => false, // Stop validation after this rule
//				//'on' => 'create', // Limit validation to 'create' or 'update' operations
//			),
      ),
  );

  //The Associations below have been created with all possible keys, those that are not needed can be removed

  /**
   * belongsTo associations
   *
   * @var array
   */
  public $belongsTo = array(
      'Shop' => array(
          'className' => 'Shop',
          'foreignKey' => 'shop_id',
          'conditions' => '',
          'fields' => '',
          'order' => ''
      ),
      'Product' => array(
          'className' => 'Product',
          'foreignKey' => 'product_id',
          'conditions' => '',
          'fields' => '',
          'order' => ''
      )
  );

}
